﻿namespace DimensionsHelper.Client.WinUi.ViewModels;

public abstract class MetadataNamedViewModel(string name, MetadataNamedObjectKind kind) : ObservableObject
{
    protected List<MetadataNamedViewModel> ChildrenInternal = [];

    public string Name { get; } = name;

    public MetadataNamedObjectKind Kind { get; } = kind;

    public IEnumerable<MetadataNamedViewModel> Children => ChildrenInternal;

    public MetadataNamedViewModel? Parent
    {
        get;
        internal set;
    }


    public string FullName
    {
        get
        {
            if (Parent == null)
            {
                return Name;
            }

            return Parent.FullName + "." + Name;
        }
    }


    protected void AddChild(MetadataNamedViewModel child)
    {
        child.Parent = this;
        ChildrenInternal.Add(child);
    }
}

public enum MetadataNamedObjectKind
{
    Property,
    Template,
    Label,
    Style,
    Category,
    Field
}